<template>
  <div>
    <header class="head">
      <div style="font-size: 50px; margin-left: 15px;">
        <el-icon @click="goBack"><Back /></el-icon>
      </div>
      <div style="color: black;font-size: 34px">消息</div>
      <div style="font-size: 22px; color: black; margin-right: 25px;" @click="clear_msg">全部已读</div>
    </header>

    <main>
      <!-- 灰色背景通知消息 -->
      <div class="ccbj" style="">
        <div class="message-box">
          <div>
            <el-icon size="40"><Close /></el-icon>
          </div>
          <div><span>打开系统通知，H币入账等消息不错过!</span></div>
          <div>
            <el-button
              type="primary"
              style="
                width: 75px;
                height: 40px;
                color: #fff;
                border-radius: 15px;
                font-size: 20px;
                background: #3087ea;
              "
              >开启</el-button
            >
          </div>
        </div>
      </div>

      <!-- 消息分类 -->
      <div class="message-sort">
        <div>
          <img src="../../image/系统消息.gif" style="width: 100px; height: 100px" @click="System_meg" />
          <span style="color: #4ecb9f">系统消息</span>
        </div>

        <div style="position: relative;">
          <img src="../../image/问诊消息.gif" style="width: 100px; height: 100px"  @click="Sedic_meg"/>

            <span style="color: #f985a3">问诊消息</span>
          <div v-if="show" class="item_title"><p style="margin-left: 13px;">5</p></div>

        </div>

        <div>
          <img src="../../image/H币入账消息.gif" style="width: 100px; height: 100px" @click="System_tmy" />
          <span style="color: orange">H币入账消息</span>
        </div>
      </div>
    </main>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router';
import { ref } from 'vue';
const router = useRouter();

const show=ref(true)
// 返回上一页
const goBack = () => {
  router.go(-1);
  console.log('点击返回上一页')
}
// 跳转系统消息详情
const System_meg = () => {
  router.push('/system_meg');
}

// 跳转问诊消息详情
const Sedic_meg = () => {
  router.push('/sedic_meg');
}

// 跳转到钱包页面
const System_tmy=()=>{
  router.push('/money');
}

// 清除消息
const clear_msg=()=>{
  console.log('已读所有消息')
  show.value=false
}
</script>

<style scoped lang="scss">

* {
  margin: 0;
  padding: 0;
}
.head {
  height: 50px; // 100px * 0.5
  line-height: 70px; // 140px * 0.5
  display: flex;
  /* background: red; */
  flex-direction: row;
  color: #999;
  flex-wrap: nowrap;
  justify-content: space-between;
}
.ccbj {
  background-color: #f2f2f2;
  height: 50px; // 100px * 0.5
  /* margin: 0 -7px 0 -7px; */
  position: relative;
}
.message-box {
  position: absolute;
  top: 7.5%; // 15% * 0.5
  left: 0.5%; // 1% * 0.5
  width: 95%; // 95% * 0.5
  height: 32.5px; // 65px * 0.5
  background: #fff;
  margin: 2.5px 5px; // 5px和10px分别减半
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  border-radius: 5px; // 10px * 0.5
}

.message-box div {
  margin: 2.5px 2.5px 2.5px 2.5px; // 5px都减半
  line-height: 25px; // 50px * 0.5
  font-size: 12px; // 24px * 0.5
}

.message-sort div {
  margin: 5px; // 10px * 0.5
  display: flex;
  /* flex-direction: row; */
  /* flex-wrap: nowrap; */
  justify-content: flex-start;
  border-bottom: solid 0.75px #e9e9e9; // 1.5px * 0.5
  padding-bottom: 5px; // 10px * 0.5
}

.message-sort div span {
  line-height: 50px; // 100px * 0.5
  margin-left: 10px; // 20px * 0.5
  font-size: 12px; // 24px * 0.5
  border: none;
}

.item_title{
  position: absolute;
  top: 17.5px; // 35px * 0.5
  right: 2.5px; // 5px * 0.5
  width: 20px; // 40px * 0.5
  height: 15px; // 30px * 0.5
  background-color: #d92109;
  text-align: center;
  line-height: 20px; // 40px * 0.5
  color: #fff;
  font-size: 10px; // 20px有误，应该是20px * 0.5 = 10px
  border-radius: 50px; // 100px * 0.5
}

</style>
